<!-- 卒中质控 -->
<style lang="less" scoped>
.chest-pain-quality {
  width: 100%;
  height: calc(100vh - 50px);
  padding: 10px;

  /deep/.el-radio__label {
    line-height: 38px;
  }

  .el-tabs {
    height: 100%;
  }

  .el-tabs__content {
    height: calc(100% - 56px);
  }

  .el-tab-pane {
    height: 100%;
  }

  .box-chose {
    height: 80px;
    padding-left: 30px;
    padding-top: 20px;
  }

  .box-echart {
    height: ~'calc(100% - 80px)';
    overflow: auto;
    background: #f0f2f5;
    padding: 20px 20px 0 20px;

    .box-card {
      width: 32%;
      height: 506px;
      display: inline-block;
      margin: 0 10px;

      .el-card__body {
        height: ~'calc(100% - 55px)';
      }
    }
  }
}
</style>

<template>
  <div class="chest-pain-quality">
    <el-form inline>
      <el-radio v-model="radioDate" label="1" @change="changeDate">
        <span style="margin-right: 5px;">指定日期</span>
        <el-form-item label="年份：">
          <el-date-picker v-model="year" type="year" value-format="yyyy" size="mini" :disabled="radioDate == 2"
            placeholder="选择年" />
        </el-form-item>
        <el-form-item label="季度：">
          <el-select v-model="quarter" size="mini" placeholder="请选择" :disabled="radioDate == 2">
            <el-option label="第一季度" :value="1" />
            <el-option label="第二季度" :value="2" />
            <el-option label="第三季度" :value="3" />
            <el-option label="第四季度" :value="4" />
          </el-select>
        </el-form-item>
        <el-form-item label="月份：">
          <el-select v-model="month" size="mini" placeholder="请选择" :disabled="radioDate == 2">
            <el-option label="一月" :value="1" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="二月" :value="2" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="三月" :value="3" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="四月" :value="4" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="五月" :value="5" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="六月" :value="6" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="七月" :value="7" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="八月" :value="8" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="九月" :value="9" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="十月" :value="10" :disabled="quarter != '' && quarter != '4'" />
            <el-option label="十一月" :value="11" :disabled="quarter != '' && quarter != '4'" />
            <el-option label="十二月" :value="12" :disabled="quarter != '' && quarter != '4'" />
          </el-select>
        </el-form-item>
      </el-radio>
      <el-radio v-model="radioDate" label="2" @change="changeDate">
        <span style="margin-right: 5px;">其他时间</span>
        <el-form-item label="">
          <el-date-picker v-model="monthRange" type="monthrange" start-placeholder="开始月份" end-placeholder="结束月份"
            size="mini" format="yyyy-MM" value-format="yyyy-MM" :disabled="radioDate == 1" />
        </el-form-item>
      </el-radio>
      <el-form-item v-if="activeName == 'strokeTreatmentProcess' || activeName == 'strokereportSituation'" label="科室：">
        <el-select v-model="dept" placeholder="请选择" size="mini" @change="deptChange">
          <el-option v-for="(item, index) in deptList" :key="index" :label="item.name" :value="item.name" />
        </el-select>
      </el-form-item>
      <el-form-item v-if="activeName == 'strokeTreatmentProcess' || activeName == 'strokereportSituation'" label="人员：">
        <el-select v-model="doc" placeholder="请选择" size="mini">
          <el-option v-for="(item, index) in docList" :key="index" :label="item.name" :value="item.name" />
        </el-select>
      </el-form-item>
      <el-form-item v-if="activeName == 'officialIndicator'" label="">
        <el-select v-model="indicatorsPlaceholder" size="mini">
          <el-option v-for="(item, index) in timeList" v-show="false" :key="index" :label="item.label"
            :value="item.label" />
          <el-tree :data="data" show-checkbox :props="defaultProps" node-key="id" :default-checked-keys="defaultKeys"
            @check-change="handleCheckChange" />
        </el-select>
      </el-form-item>
      <el-form-item label="">
        <el-button type="primary" size="mini" @click="search">搜索</el-button>
        <el-button size="mini" @click="reset">重置</el-button>
        <el-button type="primary" size="mini" @click="exportPPt">导出质控报告</el-button>
      </el-form-item>
    </el-form>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="病例分析" name="strokeCaseAnalysis">
        <strokeCaseAnalysis v-if="activeName == 'strokeCaseAnalysis'" ref="strokeCaseAnalysis" :pre-year="year"
          :pre-quarter="quarter" :pre-month="month" :pre-month-range="monthRange" />
      </el-tab-pane>
      <el-tab-pane label="救治流程" name="strokeTreatmentProcess">
        <strokeTreatmentProcess v-if="activeName == 'strokeTreatmentProcess'" ref="strokeTreatmentProcess"
          :pre-year="year" :pre-quarter="quarter" :pre-month="month" :pre-month-range="monthRange" :pre-dept="dept"
          :pre-doc="doc" />
      </el-tab-pane>
      <el-tab-pane label="上报情况" name="strokereportSituation">
        <strokereportSituation v-if="activeName == 'strokereportSituation'" ref="strokereportSituation" :pre-year="year"
          :pre-quarter="quarter" :pre-month="month" :pre-month-range="monthRange" :pre-dept="dept" :pre-doc="doc" />
      </el-tab-pane>
      <el-tab-pane label="官方指标" name="strokeQualityChart">
        <span slot="label">
          官方指标
          <el-popover placement="bottom" title="说明" width="400" trigger="hover">
            <div>统计内容为已上报数据</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </span>
        <strokeQualityChart v-if="activeName == 'strokeQualityChart'" ref="strokeQualityChart" :pre-year="year"
          :pre-quarter="quarter" :pre-month="month" :pre-month-range="monthRange" :pre-indicators="indicators" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import echarts from 'echarts'
import {
  getEmergencyTransferTime,
  getTransferOutNums,
  getTransferInNums,
  getComingWayNum,
  getHospitalTransfer,
  getPatientNum,
  getDeptList,
  getDeptUserList
} from '@/api/statistical/statisticStroke'

import createPPT from '@/utils/powerPoint/exportPowerPoint'

import {
  getODT,
  getD2Adm,
  getD2FNT,
  getD2SampleTime,
  getSample2BloodReportTime,
  getSample2CoagulReportTime,
  getD2CTReportTime,
  getThromTalk2SignTime,
  getCTReport2ThromTime,
  getDRT,
  getSurgeryNum,
  getCeaCasSurgeryModeNum,
  getNoThromReasonNum,
  getNoIntervReasonNum
} from '@/api/statistical/statisticStroke'

import {
  getDiagNum,
  // getDeptDiagNum,
  getUploadNum,
  getDeptFillInNumRanking
} from '@/api/statistical/statisticStroke'

import { getStatisticQuota } from '@/api/statistical/statisticStroke'
import strokeCaseAnalysis from './components/strokeCaseAnalysis'
import strokeTreatmentProcess from './components/strokeTreatmentProcess'
import strokereportSituation from './components/strokereportSituation'
import strokeQualityChart from './components/strokeQualityChart'
export default {
  name: 'ChestPainQuality',
  components: {
    strokeQualityChart,
    strokeCaseAnalysis,
    strokeTreatmentProcess,
    strokereportSituation
  },
  data() {
    const _this = this
    return {
      activeName: 'strokeCaseAnalysis',
      radioDate: '1',
      year: '',
      quarter: '',
      month: '',
      monthRange: [],
      indicators: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
      data: [{
        id: 1, label: '脑梗死静脉溶栓率'
      }, {
        id: 2, label: 'DNT中位数'
      }, {
        id: 3, label: 'DNT≤60分钟达标率'
      }, {
        id: 4, label: 'DPT中位数'
      }, {
        id: 5, label: 'DPT≤90分钟达标率'
      }, {
        id: 6, label: 'ONT中位数'
      }, {
        id: 7, label: 'OPT中位数'
      }, {
        id: 8, label: '脑梗死抗血小板治疗比率'
      }, {
        id: 9, label: '脑梗死吞咽困难筛查率'
      }, {
        id: 10, label: '脑梗死康复治疗率'
      }, {
        id: 11, label: '静脉溶栓及血管内治疗患者住院死亡率'
      }, {
        id: 12, label: '静脉溶栓并发症发生率'
      }, {
        id: 13, label: '血管内治疗再通率'
      }, {
        id: 14, label: '血管内治疗并发症发生率'
      }, {
        id: 15, label: '脑出血降压治疗比率'
      }, {
        id: 16, label: '脑出血康复治疗率'
      }, {
        id: 17, label: '脑出血手术患者住院死亡率'
      }, {
        id: 18, label: '脑出血手术并发症发生率'
      }, {
        id: 19, label: '破裂动脉瘤应用尼莫地平预防血管痉挛治疗比率'
      }, {
        id: 20, label: '破裂动脉瘤手术康复治疗率'
      }, {
        id: 21, label: '所有动脉瘤手术并发症发生率'
      }, {
        id: 22, label: '动脉瘤介入栓塞术并发症发生率'
      }, {
        id: 23, label: '动脉瘤开颅夹闭术并发症发生率'
      }, {
        id: 24, label: '所有动脉瘤手术患者住院死亡率'
      }, {
        id: 25, label: '动脉瘤介入栓塞术患者住院死亡率'
      }, {
        id: 26, label: '动脉瘤开颅夹闭术患者住院死亡率'
      }, {
        id: 27, label: 'CEA手术并发症发生率'
      }, {
        id: 28, label: 'CAS手术并发症发生率'
      }, {
        id: 29, label: 'CEA术后抗血小板治疗比率'
      }, {
        id: 30, label: 'CAS术后抗血小板治疗比率'
      }],
      pickerOptions: {
        disabledDate: time => {
          let year = ''
          if (_this.year) {
            year = _this.year
          } else {
            year = time.getFullYear()
          }
          const firstMonth = new Date(+year, 1)
          const lastMonth = new Date(+year, 1)
          if (_this.quarter) {
            if (_this.quarter == 1) {
              firstMonth.setMonth(0)
              lastMonth.setMonth(2)
            } else if (_this.quarter == 2) {
              firstMonth.setMonth(3)
              lastMonth.setMonth(5)
            } else if (_this.quarter == 3) {
              firstMonth.setMonth(6)
              lastMonth.setMonth(8)
            } else if (_this.quarter == 4) {
              firstMonth.setMonth(9)
              lastMonth.setMonth(11)
            }
          } else {
            firstMonth.setMonth(0)
            lastMonth.setMonth(11)
          }
          return time.getTime() < new Date(firstMonth).getTime() || time.getTime() > new Date(lastMonth).getTime()
        }
      },
      tableInData: [],
      tableOutData: [],
      tableHeader1: ['时间范围', '医院名称', '转入病例数量(例)', '占比'],
      tableHeader2: ['时间范围', '医院名称', '转出病例数量(例)', '占比'],
      comingWayNum: 0,
      dataAll: {
        jjyzsj: {// 急救转运时间趋势
          chartType: '',
          data: [{
            name: '急救转运时间',
            labels: [],
            values: []
          }]
        },
        qyszbrs: {// 全院收治病人数量趋势
          chartType: '',
          data: [{
            name: '全院收治病人数量',
            labels: [],
            values: []
          }]
        },
        lyfsfb: {// 来院方式分布统计
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        qyzybltj: {// 全院转院病例统计
          chartType: '',
          labels: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: [],
            values: []
          }, {
            name: '',
            labels: [],
            values: []
          }]
        },
        qyzyblly: {// 全院转院病例来源统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        qyzyblly2: {// 全院转院病例去向统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),

          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),

          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        fbzyydm: {// 发病至到达医院大门平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        ddyydmzjz: {// 到达医院大门至接诊平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        ddyydmzscry: {// 到达医院大门至首次入院NIHSS评分平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        ddyydmzcxwc: {// 到达医院大门至抽血完成平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        cxwczxcgjg: {// 抽血完成时间至血常规结果平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        cxwczlxgnjg: {// 抽血完成时间至凝血功能结果平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        ddyydmzctbg: {// 到达医院大门至CT报告平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        rsthzrsqz: {// 溶栓谈话至溶栓签字平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        ctbgzksjmrs: {// CT报告至开始静脉溶栓平均时间
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        dyzscxgztpjsj: {// 到院至首次血管再通平均时间（DRT）
          chartType: '',
          data: [{
            name: '月平均时间',
            labels: [],
            values: []
          }]
        },
        jskzqkzyzlcz: {// 技术开展情况-主要治疗操作
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        jskzqkcezcas: {// 技术开展情况-CEA/CAS手术采取方式
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        jskzqkwrsyy: {// 技术开展情况-未溶栓原因
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        jskzqkwjyxgnzlyy: {// 技术开展情况-未给予血管内治疗原因
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        zdfbqktj: {// 1.诊断类型分布情况统计
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        sbslqs: {// 2.上报数量趋势
          chartType: '',
          labels: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: [],
            values: []
          }, {
            name: '',
            labels: [],
            values: []
          }]
        },
        tblpm: {// 3.填报量排名
          chartType: '',
          labels: '',
          data: [{
            name: '',
            labels: [],
            values: []
          }]
        },
        gfzb: []
      },
      ppt1: require('@/assets/ppt/ppt1.png'),
      ppt2: require('@/assets/ppt/ppt2.png'),
      ppt3: require('@/assets/ppt/ppt3.png'),
      ppt1_data: '',
      ppt2_data: '',
      ppt3_data: '',
      dept: '',
      doc: '',
      deptList: [],
      docList: []
    }
  },
  mounted() {
    if (this.activeName == 'strokeCaseAnalysis') {
      this.$refs.strokeCaseAnalysis.search()
    }
  },
  methods: {
    getDept() {
      this.deptList = []
      getDeptList({
        hospitalId: this.$store.getters.hospitalId
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.deptList && res.data.deptList.length > 0) {
              this.deptList = res.data.deptList
            }
          }
        }
      })
    },
    deptChange(val) {
      this.doc = ''
      this.docList = []
      getDeptUserList({
        hospitalId: this.$store.getters.hospitalId,
        departmentName: val
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.deptUserList && res.data.deptUserList.length > 0) {
              this.docList = res.data.deptUserList
            }
          }
        }
      })
    },
    changeDate(val) {
      if (val == 1) {
        this.monthRange = []
      } else if (val == 2) {
        this.year = ''
        this.quarter = ''
        this.month = ''
      }
    },
    handleClick(tab) {
      if (tab.name == 'strokeCaseAnalysis') {
        this.$nextTick(() => {
          this.$refs.strokeCaseAnalysis.search()
        })
      } else if (tab.name == 'strokeTreatmentProcess') {
        this.$nextTick(() => {
          this.$refs.strokeTreatmentProcess.search()
        })
      } else if (tab.name == 'strokereportSituation') {
        this.$nextTick(() => {
          this.$refs.strokereportSituation.search()
        })
      } else if (tab.name == 'strokeQualityChart') {
        this.$nextTick(() => {
          this.$refs.strokeQualityChart.search()
        })
      }
    },
    reset() {
      this.radioDate = '1'
      this.year = ''
      this.quarter = ''
      this.month = ''
      this.monthRange = []
      this.dept = ''
      this.doc = ''
      this.docList = []
      this.indicators = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
      this.$nextTick(() => {
        if (this.activeName == 'strokeCaseAnalysis') {
          this.$refs.strokeCaseAnalysis.search()
        } else if (this.activeName == 'strokeTreatmentProcess') {
          this.$refs.strokeTreatmentProcess.search()
        } else if (this.activeName == 'strokereportSituation') {
          this.$refs.strokereportSituation.search()
        } else if (this.activeName == 'strokeQualityChart') {
          this.$refs.strokeQualityChart.search()
        }
      })
    },
    search() {
      if (this.activeName == 'strokeCaseAnalysis') {
        this.$refs.strokeCaseAnalysis.search()
      } else if (this.activeName == 'strokeTreatmentProcess') {
        this.$refs.strokeTreatmentProcess.search()
      } else if (this.activeName == 'strokereportSituation') {
        this.$refs.strokereportSituation.search()
      } else if (this.activeName == 'strokeQualityChart') {
        this.$refs.strokeQualityChart.search()
      }
    },
    initApi() {
      this.strokeGetComingWayNum()
      this.strokeGetEmergencyTransferTime()
      this.strokeGetPatientNum()
      this.getTransferOutNums()
      this.getTransferredCasesIn()
      this.getTransferredCasesOut()
      this.treatmentProcess()
    },
    notHaveData(chart) {
      chart.showLoading({
        text: '暂无数据',
        fontSize: 18,
        left: 'center',
        color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
        textColor: '#000', // 文字颜色
        maskColor: 'rgba(255, 255, 255, 0)' // 背景色
      })
    },

    // 急救运转时间
    strokeGetEmergencyTransferTime() {
      const chartDom = document.getElementById('get-emergency-transfer-time')
      let myChart
      if (chartDom) {
        myChart = echarts.init(chartDom)
        myChart.clear()
        myChart.hideLoading()
        window.addEventListener('resize', myChart.resize)
      }

      // console.log(this.$store.getters.hospitalName,"this.$store")
      getEmergencyTransferTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : ''
      }).then(res => {
        if (res.data) {
          if (!res.data.avgEmergencyTransferTimes || res.data.avgEmergencyTransferTimes.length === 0) {
            if (chartDom) {
              this.notHaveData(myChart)
            }
            return
          }
          const timeLine = []
          const showDataList = []
          res.data.avgEmergencyTransferTimes.forEach(el => {
            timeLine.push(el.year + '-' + el.month)
            showDataList.push(el.avgQuotaMinute)
          })
          const option = {
            color: ['#027DB4'],
            title: {
              text: '',
              subtext: '',
              left: 'center'
            },
            xAxis: {
              name: '',
              type: 'category',
              data: timeLine
            },
            yAxis: {
              name: '(分钟)',
              type: 'value'
            },
            series: [
              {
                data: showDataList,
                type: 'line',
                label: {
                  show: true,
                  position: 'top'
                },
                smooth: true
              }
            ]
          }
          this.dataAll.jjyzsj.data[0].labels = timeLine
          this.dataAll.jjyzsj.data[0].values = showDataList
          if (chartDom) {
            myChart.setOption(option)
          }
        } else {
          if (chartDom) {
            this.notHaveData(myChart)
          }
        }
      })
    },
    // 全员病人收治人数
    strokeGetPatientNum() {
      const chartDom = document.getElementById('get-patient-num')
      let myChart
      if (chartDom) {
        myChart = echarts.init(chartDom)
        myChart.clear()
        myChart.hideLoading()
        window.addEventListener('resize', myChart.resize)
      }

      getPatientNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : ''
      }).then(res => {
        if (res.data) {
          if (!res.data.patientNums || res.data.patientNums.length === 0) {
            if (chartDom) {
              this.notHaveData(myChart)
            }
            return
          }
          const timeLine = []
          const showDataList = []
          res.data.patientNums.forEach(el => {
            timeLine.push(el.year + '-' + el.month)
            showDataList.push(el.patientNum)
          })
          const option = {
            color: ['#027DB4'],
            title: {
              text: '',
              subtext: '',
              left: 'center'
            },
            xAxis: {
              name: '',
              type: 'category',
              data: timeLine
            },
            yAxis: {
              name: '(例)',
              type: 'value'
            },
            series: [
              {
                data: showDataList,
                type: 'line',
                label: {
                  show: true,
                  position: 'top'
                },
                smooth: true
              }
            ]
          }
          // console.log(timeLine,"timeLine1111111")
          // console.log(showDataList,"showDataList111111111111111111111111111")
          this.dataAll.qyszbrs.data[0].labels = timeLine
          this.dataAll.qyszbrs.data[0].values = showDataList
          this.dataAll.qyszbrs.data[0].name = '全院收治病人数量:' + eval(showDataList.join('+'))
          if (chartDom) {
            myChart.setOption(option)
          }
        } else {
          if (chartDom) {
            this.notHaveData(myChart)
          }
        }
      })
    },
    // 全院转院病例统计
    getTransferOutNums() {
      const transferredHospital = document.getElementById('getHospitalTransfer')
      let myChart
      if (transferredHospital) {
        myChart = echarts.init(transferredHospital)
        myChart.clear()
        myChart.hideLoading()
        window.addEventListener('resize', myChart.resize)
      }

      getHospitalTransfer({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const transferInList = []
            const transferOutList = []
            const transferInOutList = []
            if (res.data.transferInOutNumList && res.data.transferInOutNumList.length > 0) {
              res.data.transferInOutNumList.forEach(el => {
                const timeData = el.year + '-' + el.month
                timeLine.push(timeData)
                transferInList.push(el.transferInNum ? el.transferInNum : 0)
                transferOutList.push(el.transferOutNum ? el.transferOutNum : 0)
                transferInOutList.push(el.transferInOutNum ? el.transferInOutNum : 0)
              })

              const option = {
                color: ['#027DB4', '#F59A23', '#D9001BA1'],
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  // orient: 'vertical',
                  // right: 0,
                  // top: '50px',
                  formatter: name => {
                    if (name == '转院病人总数') {
                      return name + '：' + (res.data.totalTransfer ? res.data.totalTransfer : 0) + '例'
                    }
                    if (name == '外院转入总数') {
                      return name + '：' + (res.data.subtotalTransferIn ? res.data.subtotalTransferIn : 0) + '例' + ' ' + (res.data.percentTransferIn ? res.data.percentTransferIn : 0) + '%'
                    }
                    if (name == '本院转出总数') {
                      return name + '：' + (res.data.subtotalTransferOut ? res.data.subtotalTransferOut : 0) + '例' + ' ' + (res.data.percentTransferOut ? res.data.percentTransferOut : 0) + '%'
                    }
                  }
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '例',
                  type: 'value'
                },
                series: [{
                  name: '转院病人总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: transferInOutList
                }, {
                  name: '外院转入总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: transferInList
                }, {
                  name: '本院转出总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: transferOutList
                }]
              }
              this.dataAll.qyzybltj.labels = timeLine
              // console.log(this.dataAll.qyzybltj.labels, 'this.dataAll.qyzybltj.labels')
              this.dataAll.qyzybltj.data1[0].values = transferInOutList
              this.dataAll.qyzybltj.data1[0].labels = this.dataAll.qyzybltj.labels
              this.dataAll.qyzybltj.data2[0].values = transferInList
              this.dataAll.qyzybltj.data2[0].labels = this.dataAll.qyzybltj.labels
              this.dataAll.qyzybltj.data2[1].values = transferOutList
              this.dataAll.qyzybltj.data2[1].labels = this.dataAll.qyzybltj.labels
              if (transferredHospital) {
                myChart.setOption(option)
              }
            } else {
              if (transferredHospital) {
                this.notHaveData(myChart)
              }
            }
          }
        } else {
          if (transferredHospital) {
            this.notHaveData(myChart)
          }
        }
      })
    },

    // 来源方式分布情况统计
    strokeGetComingWayNum() {
      const chartDom = document.getElementById('get-coming-way-num')
      let myChart
      if (chartDom) {
        myChart = echarts.init(chartDom)
        myChart.clear()
        myChart.hideLoading()
        window.addEventListener('resize', myChart.resize)
      }

      getComingWayNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (!res.data) {
          if (chartDom) {
            this.notHaveData(myChart)
          }
          return
        }
        this.comingWayNum = res.data.total
        if (!this.comingWayNum || this.comingWayNum === 0) {
          if (chartDom) {
            this.notHaveData(myChart)
          }
          return
        }
        this.dataAll.lyfsfb = {
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        }
        const numComingWay1 = res.data.comingWayNum.numComingWay1
        const numComingWay2 = res.data.comingWayNum.numComingWay2
        const numComingWay3 = res.data.comingWayNum.numComingWay3
        const numComingWay4 = res.data.comingWayNum.numComingWay4
        const numComingWay5 = res.data.comingWayNum.numComingWay5
        const numComingWayUnknown = res.data.comingWayNum.numComingWayUnknown

        const comingWay1 = res.data.comingWayPercentage.comingWay1
        const comingWay2 = res.data.comingWayPercentage.comingWay2
        const comingWay3 = res.data.comingWayPercentage.comingWay3
        const comingWay4 = res.data.comingWayPercentage.comingWay4
        const comingWay5 = res.data.comingWayPercentage.comingWay5
        const comingWayUnknown = res.data.comingWayPercentage.comingWayUnknown

        const diagMain = [{ value: numComingWay1, name: '本院急救车', rate: comingWay1 },
        { value: numComingWay2, name: '当地120', rate: comingWay2 },
        { value: numComingWay3, name: '外院转院', rate: comingWay3 },
        { value: numComingWay4, name: '自行来院', rate: comingWay4 },
        { value: numComingWay5, name: '在院卒中', rate: comingWay5 },
        { value: numComingWayUnknown, name: '未知', rate: comingWayUnknown }]

        const option = {
          tooltip: {
            trigger: 'item'
          },
          legend: {
            orient: 'vertical',
            left: '30%',
            formatter: name => {
              const nameList = diagMain.filter(item => {
                return item.name === name
              })
              return nameList[0].name + '：' + nameList[0].value + '例' + ' ' + nameList[0].rate + '%'
            }
          },
          series: [
            {
              // name: 'Access From',
              type: 'pie',
              radius: '50%',
              data: diagMain,
              emphasis: {
                itemStyle: {
                  shadowBlur: 10,
                  shadowOffsetX: 0,
                  shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
              }
            }
          ]
        }
        diagMain.forEach(el => {
          this.dataAll.lyfsfb.data1[0].labels.push(el.name + ':' + el.value)
          this.dataAll.lyfsfb.data1[0].values.push(el.value)
        })
        this.dataAll.lyfsfb.data2[0].values = [this.comingWayNum]
        if (chartDom) {
          myChart.setOption(option)
        }
      })
    },

    // 全院转院病例来源统计
    getTransferredCasesIn() {
      this.tableInData = []
      getTransferInNums({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.transferInHospitalNums && res.data.transferInHospitalNums.length > 0) {
              this.tableInData = res.data.transferInHospitalNums
              let temp_data = []
              for (let i = 0; i < this.tableHeader1.length; i++) {
                temp_data.push(
                  {
                    text: this.tableHeader1[i],
                    options: this.dataAll.qyzyblly.options1
                  }
                )
              }
              this.dataAll.qyzyblly.data.push(temp_data)
              temp_data = []
              for (let i = 0; i < this.tableInData.length; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: this.tableInData[i].year + '-' + this.tableInData[i].month,
                    options: this.dataAll.qyzyblly.options2
                  })
                  temp_data.push({
                    text: this.tableInData[i].hospitalName,
                    options: this.dataAll.qyzyblly.options2
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferInNum,
                    options: this.dataAll.qyzyblly.options2
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferPercentage,
                    options: this.dataAll.qyzyblly.options2
                  })
                } else {
                  temp_data.push({
                    text: this.tableInData[i].year + '-' + this.tableInData[i].month,
                    options: this.dataAll.qyzyblly.options3
                  })
                  temp_data.push({
                    text: this.tableInData[i].hospitalName,
                    options: this.dataAll.qyzyblly.options3
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferInNum,
                    options: this.dataAll.qyzyblly.options3
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferPercentage,
                    options: this.dataAll.qyzyblly.options3
                  })
                }
                this.dataAll.qyzyblly.data.push(temp_data)
              }
            }
          }
        }
      })
    },
    // 全院转院病例去向统计
    getTransferredCasesOut() {
      this.tableOutData = []
      getTransferOutNums({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.transferOutHospitalNums && res.data.transferOutHospitalNums.length > 0) {
              this.tableOutData = res.data.transferOutHospitalNums
              let temp_data = []
              for (let i = 0; i < this.tableHeader2.length; i++) {
                temp_data.push(
                  {
                    text: this.tableHeader2[i],
                    options: this.dataAll.qyzyblly2.options1
                  }
                )
              }
              this.dataAll.qyzyblly2.data.push(temp_data)
              temp_data = []
              for (let i = 0; i < this.tableOutData.length; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 1) {
                  temp_data.push({
                    text: this.tableOutData[i].year + '-' + this.tableOutData[i].month,
                    options: this.dataAll.qyzyblly2.options2
                  })
                  temp_data.push({
                    text: this.tableOutData[i].hospitalName,
                    options: this.dataAll.qyzyblly2.options2
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferOutNum,
                    options: this.dataAll.qyzyblly2.options2
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferPercentage,
                    options: this.dataAll.qyzyblly2.options2
                  })
                } else {
                  temp_data.push({
                    text: this.tableOutData[i].year + '-' + this.tableOutData[i].month,
                    options: this.dataAll.qyzyblly2.options3
                  })
                  temp_data.push({
                    text: this.tableOutData[i].hospitalName,
                    options: this.dataAll.qyzyblly2.options3
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferOutNum,
                    options: this.dataAll.qyzyblly2.options3
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferPercentage,
                    options: this.dataAll.qyzyblly2.options3
                  })
                }
                this.dataAll.qyzyblly2.data.push(temp_data)
              }
            }
          }
        }
      })
    },
    exportPPt() {
      this.initApi()

      if (this.year === '' && this.monthRange.length == 0) {
        this.$message({
          message: '导出前请先选择年份!',
          type: 'warning'
        })
        return
      }
      this.treatmentProcess()
      const loading = this.$loading({
        lock: true, // lock的修改符--默认是false
        text: '正在导出', // 显示在加载图标下方的加载文案
        spinner: 'el-icon-loading', // 自定义加载图标类名
        // background: 'rgba(0, 0, 0, 0.7)', // 遮罩层颜色
        target: document.querySelector('#rootNode') // loadin覆盖的dom元素节点
      })

      const color_jjyzsj = ['4874cb']
      const color_jjyzsj_title = '993366'

      const color_qyzybl = ['ee822f', 'f2ba02']
      const color_lyfsfb = ['4874cb', 'ee822f', 'f2ba02', '30c0b4', '75bd42', 'e54c5e']
      const pptfile = new createPPT()
      pptfile.initPPt()
      this.fetchImage1(this.ppt1)
      this.fetchImage2(this.ppt2)
      this.fetchImage3(this.ppt3)
      // console.log(this.ppt1_data, this.ppt2_data, this.ppt3_data)
      setTimeout(() => {
        let exportTime = '未设置时间范围'
        if (this.monthRange.length == 2) {
          exportTime = this.monthRange[0] + '~' + this.monthRange[1]
        } else if (this.month || this.year || this.quarter) {
          let quarter_value
          let month_value

          if (this.month !== '') {
            month_value = '-' + this.month
          } else {
            month_value = '全年'
          }
          if (this.quarter != '' && this.month == '') {
            quarter_value = this.quarter
          } else if (this.quarter == '') {
            quarter_value = ''
          }
          switch (quarter_value) {
            case 1:
              quarter_value = '一'
              break
            case 2:
              quarter_value = '二'
              break
            case 3:
              quarter_value = '三'
              break
            case 4:
              quarter_value = '四'
              break
            default:
              break
          }
          exportTime = (this.year ? this.year + '年' : new Date().getFullYear() + '年') + (quarter_value ? quarter_value + '季度' : '') + (quarter_value ? ((month_value !== '' && month_value !== '全年') ? '-' + month_value + '月' : '') : (month_value === '全年' ? '-' + month_value : month_value + '月'))
        } else if (this.month == '' && this.year == '' && this.quarter == '') {
          exportTime = new Date().getFullYear() + '全年'
        }
        const tjzq = {
          text: '统计周期：' + exportTime,
          style: {
            x: '30%',
            y: '5%',
            fontFace: '仿宋', // 字体
            fontSize: 18, // 字号
            color: color_jjyzsj_title
          }
        }
        const sjly = {
          text: '数据来源：云智医卒中中心系统V1.0',
          style: {
            x: '35%',
            y: '95%',
            bold: true,
            fontFace: '宋体', // 字体
            fontSize: 14, // 字号
            color: '898989'
          }
        }
        pptfile.ppt1 = this.ppt1_data
        pptfile.ppt2 = this.ppt2_data
        pptfile.ppt3 = this.ppt3_data
        // console.log(pptfile.ppt1, pptfile.ppt2, pptfile.ppt3)
        const PPT1 = [
          {
            text: '卒中数据报告',
            style: {
              x: '15%',
              y: '25%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 60, // 字号
              color: '1aa7ad'
            }
          },
          {
            text: '[' + this.$store.getters.hospitalName + ']',
            style: {
              x: '25%',
              y: '40%',
              bold: true,
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '7a3a7a'
            }
          },
          {
            text: '数据统计周期：' + exportTime,
            style: {
              x: '25%',
              y: '50%',
              bold: true,
              fontFace: '宋体', // 字体
              fontSize: 14, // 字号
              color: '000000'
            }
          },
          {
            text: '汇报方：心智医联(北京)科技有限公司',
            style: {
              x: '18%',
              y: '60%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: '7f7f7f'
            }
          }
        ]
        PPT1.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT1, 1)
        const PPT2 = [
          {
            text: '目录',
            style: {
              x: '15%',
              y: '25%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 54, // 字号
              color: '1aa7ad'
            }
          },
          {
            text: '收治情况\n救治流程\n上报情况\n官方指标',
            style: {
              x: '20%',
              y: '50%',
              fontFace: '黑体', // 字体
              fontSize: 24, // 字号
              color: '595959'
            }
          }
        ]
        PPT2.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT2, 2)
        const PPT3 = [
          {
            text: '一 收治情况',
            style: {
              x: '70%',
              y: '40%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'

            }
          },
          {
            text: '急救转运时间趋势\n收治病人情况分析\n转院情况分析',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }

          }
        ]
        PPT3.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT3, 3)

        const opts4 = this.initOpts('1.急救转运时间趋势（单位：分钟）', color_jjyzsj_title, color_jjyzsj)
        const PPT4 = [
          {
            text: '计算方式：“到达医院大门时间”与“120离开现场时间”的差值',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT4.push(sjly)
        PPT4.push(tjzq)
        pptfile.addPage()
        pptfile.addText(PPT4, 2)
        pptfile.addline(this.dataAll.jjyzsj.data, opts4)

        const PPT5 = [
          {
            text: '计算方式：建档病例数量',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT5.push(sjly)
        PPT5.push(tjzq)
        const opts5 = this.initOpts('2.全院收治病人数量趋势（单位：例）', color_jjyzsj_title, color_jjyzsj)
        pptfile.addPage()
        pptfile.addText(PPT5, 2)
        pptfile.addline(this.dataAll.qyszbrs.data, opts5)
        // console.log('2.全院收治病人数量趋势（单位：例）',this.dataAll.qyszbrs.data)
        const PPT6 = [
          {
            text: '3.来院方式分布情况统计（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：全部病例“来院方式”的类型分布和占比情况，未填写计入“未知”',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT6.push(sjly)
        PPT6.push(tjzq)
        const opts6 = this.initOptsPie('', '595959', color_lyfsfb)
        const opts6_2 = this.initOptsBar(color_jjyzsj, '15%')
        pptfile.addPage()
        pptfile.addText(PPT6, 2)
        pptfile.addBar(this.dataAll.lyfsfb.data2, opts6_2)
        pptfile.addPieDOUGHNUT(this.dataAll.lyfsfb.data1, opts6)
        console.log(this.dataAll.lyfsfb.data2, 'this.dataAll.lyfsfb.data2')
        console.log(this.dataAll.lyfsfb.data1, 'this.dataAll.lyfsfb.data1')

        const PPT7 = [
          {
            text: '4.全院转院病例统计（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：转院病人总数=外院转入总数+本院转出总数',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT7.push(sjly)
        PPT7.push(tjzq)
        const opts7 = this.initOptCombo(color_qyzybl)
        pptfile.addPage()
        const combo7 = [
          {
            type: pptfile.pres.charts.BAR,
            data: [
              {
                name: '外院转入总数:' + eval(this.dataAll.qyzybltj.data2[0].values.join('+')),
                labels: this.dataAll.qyzybltj.labels,
                values: this.dataAll.qyzybltj.data2[0].values
              },
              {
                name: '本院转出总数:' + eval(this.dataAll.qyzybltj.data2[1].values.join('+')),
                labels: this.dataAll.qyzybltj.labels,
                values: this.dataAll.qyzybltj.data2[1].values
              }
            ],
            options: {
              chartColors: color_qyzybl,
              barGrouping: 'standard',
              dataLabelColor: '000000'
            }
          },
          {
            type: pptfile.pres.charts.LINE,
            data: [
              {
                name: '转院病人总数:' + eval(this.dataAll.qyzybltj.data1[0].values.join('+')),
                labels: this.dataAll.qyzybltj.labels,
                values: this.dataAll.qyzybltj.data1[0].values
              }
            ],
            options: {
              chartColors: ['F38940'],
              dataLabelColor: 'F38940'
            }
          }
        ]
        pptfile.addText(PPT7, 2)
        pptfile.addCombo(combo7, opts7)

        const PPT8 = [
          {
            text: '5.全院转院病例来源统计',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT8.push(sjly)
        PPT8.push(tjzq)
        const opts8 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT8, 2)
        console.log(this.dataAll.qyzyblly.data)
        pptfile.addTable(this.dataAll.qyzyblly.data, opts8)

        const PPT9 = [

          {
            text: '6.全院转院病例去向统计',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT9.push(sjly)
        PPT9.push(tjzq)
        const opts9 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT9, 2)
        pptfile.addTable(this.dataAll.qyzyblly2.data, opts9)
        // console.log(this.dataAll.qyzyblly2.data)
        const PPT10 = [
          {
            text: '二 救治流程',
            style: {
              x: '70%',
              y: '40%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'
            }
          },
          {
            text: '流程时间节点分析\n技术开展情况分析\n未溶栓/血管内治疗原因分析',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }
          }
        ]
        PPT10.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT10, 3)

        const PPT11 = [
          {
            text: '1.发病至到达医院大门平均时间（ODT）（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT11.push(sjly)
        PPT11.push(tjzq)
        const opts11 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT11, 2)
        pptfile.addBar(this.dataAll.fbzyydm.data, opts11)

        const PPT12 = [
          {
            text: '2.到达医院大门至接诊平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT12.push(sjly)
        PPT12.push(tjzq)
        const opts12 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT12, 2)
        pptfile.addBar(this.dataAll.ddyydmzjz.data, opts12)

        const PPT13 = [
          {
            text: '3.到达医院大门至首次入院NIHSS评分平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT13.push(sjly)
        PPT13.push(tjzq)
        const opts13 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT13, 2)
        pptfile.addBar(this.dataAll.ddyydmzscry.data, opts13)

        const PPT14 = [
          {
            text: '4.到达医院大门至抽血完成平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT14.push(sjly)
        PPT14.push(tjzq)
        const opts14 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT14, 2)
        pptfile.addBar(this.dataAll.ddyydmzcxwc.data, opts14)

        const PPT15 = [
          {
            text: '5.抽血完成时间至血常规结果平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT15.push(sjly)
        PPT15.push(tjzq)
        const opts15 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT15, 2)
        pptfile.addBar(this.dataAll.cxwczxcgjg.data, opts15)

        const PPT16 = [
          {
            text: '6.抽血完成时间至凝血功能结果平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT16.push(sjly)
        PPT16.push(tjzq)
        const opts16 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT16, 2)
        pptfile.addBar(this.dataAll.cxwczlxgnjg.data, opts16)

        const PPT17 = [
          {
            text: '7.到达医院大门至CT报告平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT17.push(sjly)
        PPT17.push(tjzq)
        const opts17 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT17, 2)
        pptfile.addBar(this.dataAll.ddyydmzctbg.data, opts17)

        const PPT18 = [
          {
            text: '8.溶栓谈话至溶栓签字平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT18.push(sjly)
        PPT18.push(tjzq)
        const opts18 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT18, 2)
        pptfile.addBar(this.dataAll.rsthzrsqz.data, opts18)

        const PPT19 = [
          {
            text: '9.CT报告至开始静脉溶栓平均时间（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT19.push(sjly)
        PPT19.push(tjzq)
        const opts19 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT19, 2)
        pptfile.addBar(this.dataAll.ctbgzksjmrs.data, opts19)

        const PPT20 = [
          {
            text: '10.到院至首次血管再通平均时间（DRT）（单位：分钟）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT20.push(sjly)
        PPT20.push(tjzq)
        const opts20 = this.initOptsBar(color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT20, 2)
        pptfile.addBar(this.dataAll.dyzscxgztpjsj.data, opts20)

        const PPT21 = [
          {
            text: '11.技术开展情况-主要治疗操作（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：根据诊断自动匹配的治疗类型',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT21.push(sjly)
        PPT21.push(tjzq)
        const opts21 = this.initOptsBar(color_jjyzsj, '15%')
        const opts21_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT21, 2)
        pptfile.addBar(this.dataAll.jskzqkzyzlcz.data2, opts21)
        pptfile.addPieDOUGHNUT(this.dataAll.jskzqkzyzlcz.data1, opts21_2)

        const PPT22 = [
          {
            text: '12.技术开展情况-CEA/CAS手术采取方式（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：“手术治疗”中“CEA/CAS”的“手术采取方式的分类统计',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT22.push(sjly)
        PPT22.push(tjzq)
        const opts22 = this.initOptsBar(color_jjyzsj, '15%')
        const opts22_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT22, 2)
        pptfile.addBar(this.dataAll.jskzqkcezcas.data2, opts22)
        pptfile.addPieDOUGHNUT(this.dataAll.jskzqkcezcas.data1, opts22_2)

        const PPT23 = [
          {
            text: '13.未溶栓原因（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：统计“未给予溶栓原因”，未填写不计',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT23.push(sjly)
        PPT23.push(tjzq)
        const opts23 = this.initOptsBar(color_jjyzsj, '15%')
        const opts23_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT23, 2)
        pptfile.addBar(this.dataAll.jskzqkwrsyy.data2, opts23)
        pptfile.addPieDOUGHNUT(this.dataAll.jskzqkwrsyy.data1, opts23_2)
        const PPT24 = [
          {
            text: '14.未给予血管内治疗原因（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：统计“未给予血管内治疗的原因”，未填写不计',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT24.push(sjly)
        PPT24.push(tjzq)
        const opts24 = this.initOptsBar(color_jjyzsj, '15%')
        const opts24_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT24, 2)
        pptfile.addBar(this.dataAll.jskzqkwjyxgnzlyy.data2, opts24)
        pptfile.addPieDOUGHNUT(this.dataAll.jskzqkwjyxgnzlyy.data1, opts24_2)

        const PPT25 = [
          {
            text: '三 上报情况',
            style: {
              x: '70%',
              y: '40%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'
            }
          },
          {
            text: '诊断类型分布情况统计\n上报数量趋势\n填报量排名',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }
          }
        ]
        PPT25.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT25, 3)

        const PPT26 = [
          {
            text: '1.诊断类型分布情况统计（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：统计诊断的类型分布和占比情况，未填写计入“未知”',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT26.push(sjly)
        PPT26.push(tjzq)
        const opts26 = this.initOptsBar(color_jjyzsj, '15%')
        const opts26_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT26, 2)
        pptfile.addBar(this.dataAll.zdfbqktj.data2, opts26)
        pptfile.addPieDOUGHNUT(this.dataAll.zdfbqktj.data1, opts26_2)

        const PPT27 = [
          {
            text: '2.上报数量趋势（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：“建档病例数”=“初始填写”+“已下载”的数量，状态数量/总数=该状态占比',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT27.push(sjly)
        PPT27.push(tjzq)
        const opts27 = this.initOptCombo(color_qyzybl)
        pptfile.addPage()
        const combo27 = [
          {
            type: pptfile.pres.charts.BAR,
            data: [
              {
                name: '初始填写:' + eval(this.dataAll.sbslqs.data2[0].values.join('+')),
                labels: this.dataAll.sbslqs.labels,
                values: this.dataAll.sbslqs.data2[0].values
              },
              {
                name: '已下载:' + eval(this.dataAll.sbslqs.data2[1].values.join('+')),
                labels: this.dataAll.sbslqs.labels,
                values: this.dataAll.sbslqs.data2[1].values
              }
            ],
            options: {
              chartColors: color_qyzybl,
              barGrouping: 'standard',
              dataLabelColor: '000000'
            }
          },
          {
            type: pptfile.pres.charts.LINE,
            data: [
              {
                name: '建档病例数:' + eval(this.dataAll.sbslqs.data1[0].values.join('+')),
                labels: this.dataAll.sbslqs.labels,
                values: this.dataAll.sbslqs.data1[0].values
              }
            ],
            options: {
              chartColors: ['F38940'],
              dataLabelColor: 'F38940'
            }
          }
        ]
        pptfile.addText(PPT27, 2)
        pptfile.addCombo(combo27, opts27)

        const PPT28 = [
          {
            text: '3.填报量排名（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：各科室建档病例数量统计',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT28.push(sjly)
        PPT28.push(tjzq)
        const opts28 = this.initOptsBarV('填报数量', color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT28, 2)
        pptfile.addBar(this.dataAll.tblpm.data, opts28)

        const PPT29 = [
          {
            text: '四 官方指标',
            style: {
              x: '70%',
              y: '40%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'
            }
          },
          {
            text: '脑梗死静脉溶栓及血管内治疗指标\n脑出血围手术期指标\n蛛网膜下腔出血及颅内动脉瘤围手术期指标\nCEA和CAS围手术期指标',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 12, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }
          }
        ]
        PPT29.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT29, 3)
        const reset_num1 = [13, 3, 7]
        let reset_num2 = 0
        for (let i = 0; i < this.dataAll.gfzb.length; i++) {
          const add_arr = [
            {
              text: (i + 1 - reset_num2) + '.' + this.dataAll.gfzb[i].name + '（单位：' + this.dataAll.gfzb[i].optionData.unit + '）',
              style: {
                x: '25%',
                y: '15%',
                bold: true,
                fontFace: 'Microsoft YaHei', // 字体
                fontSize: 14, // 字号
                color: color_jjyzsj_title
              }
            }
          ]
          add_arr.push(sjly)
          add_arr.push(tjzq)
          pptfile.addPage()
          if (i === 14) {
            add_arr.push({
              text: '二、脑出血围手术期 ',
              style: {
                x: '30%',
                y: '10%',
                fontFace: '仿宋', // 字体
                fontSize: 14, // 字号
                color: '595959'
              }
            })
          } else if (i === 0) {
            add_arr.push({
              text: '一、脑梗死静脉溶栓及血管内治疗',
              style: {
                x: '30%',
                y: '10%',
                fontFace: '仿宋', // 字体
                fontSize: 14, // 字号
                color: '595959'
              }
            })
          } else if (i === 18) {
            add_arr.push({
              text: '三、蛛网膜下腔出血及颅内动脉瘤围手术期',
              style: {
                x: '30%',
                y: '10%',
                fontFace: '仿宋', // 字体
                fontSize: 14, // 字号
                color: '595959'
              }
            })
          } else if (i === 26) {
            add_arr.push({
              text: '四、CEA和CAS围手术期',
              style: {
                x: '30%',
                y: '10%',
                fontFace: '仿宋', // 字体
                fontSize: 14, // 字号
                color: '595959'
              }
            })
          }

          pptfile.addText(add_arr, 2)
          pptfile.addBar([{
            name: this.dataAll.gfzb[i].name,
            labels: this.dataAll.gfzb[i].optionData.timeData,
            values: this.dataAll.gfzb[i].optionData.targetData
          }], this.initOptsBar(color_jjyzsj, '75%'))
          if (reset_num1.length > 0 && i === reset_num2 + reset_num1[0]) {
            reset_num2 += reset_num1[0] + 1
            reset_num1.shift()
          }
        }
        const PPT60 = [
          {
            text: '谢 谢！',
            style: {
              x: '65%',
              y: '45%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 54, // 字号
              color: 'ffffff'
            }
          }
        ]
        PPT60.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT60, 3)
        pptfile.exportPowerPoint('卒中质控报告 ' + exportTime).then(() => {
          console.log('导出完毕')
          loading.close()
        })
      }, 3000)
      // setTimeout(() => {
      //   loading.close()
      // }, 10000)
      setTimeout(() => {
        loading.close()
      }, 60000)
    },
    initOpts(title, titleColor, chartColors) {
      return {
        x: 1,
        y: 0.6,
        w: '75%',
        h: '80%',
        barDir: 'col',
        dataBorder: { pt: '0.2', color: 'eeeeee' },	// 柱状图柱子边框线
        catAxisLabelColor: '595959', // 横轴刻度字体颜色
        valAxisLabelColor: '595959', // 纵轴刻度字体颜色
        catAxisLabelFontSize: 8,	// 横轴刻度字体大小
        valAxisLabelFontSize: 8,	// 纵轴刻度字体大小
        showLegend: true,	// 展示legend 就是一个小颜色块，戳一下可以控制对应数据的显示隐藏的那个东西
        legendColor: '595959', // legend颜色
        legendFontSize: 8,	// legend字体
        legendPos: 'b',	// legend位置 b 是底部，t 是顶部
        showTitle: true,	// 展示标题
        titleColor: titleColor, // 标题颜色
        titleAlign: 'center', // 标题左右居中
        titleFontSize: 24, // 标题字体
        valGridLine: { pt: '0.2', color: 'eeeeee' }, // y轴网格刻度线
        title: title, // 标题
        chartColors: chartColors, // 柱状图颜色列表
        barGapWidthPct: 1500, // 柱状图宽度，最大500，这里除一下数组宽度,不然可能会矮矮胖胖
        showValue: true, // 是否展示数值
        dataLabelColor: '595959', // 数值字体颜色
        dataLabelFontFace: 'Microsoft YaHei', // 数值字体
        dataLabelFontSize: 6,	 // 数值字体大小
        dataLabelPosition: 'outEnd' // 数值出现位置
      }
    },
    initOptsBar(chartColors, width) {
      return {
        x: 1,
        y: 1.2,
        w: width,
        h: 3.4,
        barDir: 'col',
        dataBorder: { pt: '0.2', color: 'eeeeee' },	// 柱状图柱子边框线
        catAxisLabelColor: '595959', // 横轴刻度字体颜色
        valAxisLabelColor: '595959', // 纵轴刻度字体颜色
        catAxisLabelFontSize: 8,	// 横轴刻度字体大小
        valAxisLabelFontSize: 8,	// 纵轴刻度字体大小
        legendColor: '595959', // legend颜色
        legendFontSize: 8,	// legend字体
        legendPos: 'b',	// legend位置 b 是底部，t 是顶部
        valGridLine: { pt: '0.2', color: 'eeeeee' }, // y轴网格刻度线
        showLegend: true,
        chartColors: chartColors, // 柱状图颜色列表
        showValue: true, // 是否展示数值
        dataLabelColor: '595959', // 数值字体颜色
        dataLabelFontFace: 'Microsoft YaHei', // 数值字体
        dataLabelFontSize: 6,	 // 数值字体大小
        dataLabelPosition: 'outEnd' // 数值出现位置
      }
    },
    initOptsBarV(title, chartColors, width) {
      return {
        x: 1,
        y: 1.2,
        w: width,
        h: 3.4,
        barDir: 'bar',
        dataBorder: { pt: '0.2', color: 'eeeeee' },	// 柱状图柱子边框线
        catAxisLabelColor: '595959', // 横轴刻度字体颜色
        valAxisLabelColor: '595959', // 纵轴刻度字体颜色
        // catAxisHidden: true,
        valGridLine: { style: 'none' },
        valAxisHidden: true,
        title: title, // 标题
        showLegend: true,
        catAxisLabelFontSize: 8,	// 横轴刻度字体大小
        valAxisLabelFontSize: 8,	// 纵轴刻度字体大小
        legendColor: '595959', // legend颜色
        legendFontSize: 8,	// legend字体
        legendPos: 'b',	// legend位置 b 是底部，t 是顶部
        chartColors: chartColors, // 柱状图颜色列表
        showValue: true, // 是否展示数值
        dataLabelColor: '595959', // 数值字体颜色
        dataLabelFontFace: 'Microsoft YaHei', // 数值字体
        dataLabelFontSize: 6,	 // 数值字体大小
        dataLabelPosition: 'outEnd' // 数值出现位置
      }
    },
    initOptsTable() {
      return {
        x: 1,
        y: 1.2,
        w: '75%',
        h: '80%',
        rowH: 0.31, // 单元格默认高度
        valign: 'middle',
        fontSize: 8,
        color: '666666',
        align: 'center',
        border: { pt: 1, color: 'ffffff' }
      }
    },
    initOptsTableRow(valign, border, fill, color) {
      return { valign: valign, border: border, fill: fill, color: color }
    },
    initOptsPie(title, titleColor, chartColors) {
      return {
        x: 2.5,
        y: 1.2,
        w: 5.5,
        h: 3.4,
        chartArea: { fill: { color: 'F1F1F1' } },
        // holeSize: 10,
        // showLabel: true,
        // showValue: true,
        showPercent: true,
        showLegend: true,
        legendPos: 'b',
        //
        chartColors: chartColors,
        dataBorder: { pt: '1', color: 'F1F1F1' },
        dataLabelColor: '000000',
        dataLabelFontSize: 8,
        //
        showTitle: false,
        title: title,
        titleColor: titleColor,
        titleFontFace: 'Microsoft YaHei',
        titleFontSize: 19.2
      }
    },
    initOptCombo(chartColors) {
      return {
        x: 1,
        y: 1.2,
        w: '75%',
        h: 3.4,
        chartArea: { fill: { color: 'F1F1F1' } },
        barDir: 'col',
        barGrouping: 'stacked',
        catAxisLabelColor: '595959',
        catAxisLabelFontFace: 'Arial',
        catAxisLabelFontSize: 12,
        catAxisOrientation: 'minMax',
        showLegend: true,
        legendPos: 'b',
        showTitle: false,
        showValue: true // 是否展示数值
        // valAxisMaxVal: 100,
        // valAxisMajorUnit: 10
      }
    },
    treatmentProcess() {
      this.StrokeGetODT()
      this.StrokeGetD2Adm()
      this.StrokeGetD2FNT()
      this.StrokeGetD2SampleTime()
      this.StrokeGetSample2BloodReportTime()
      this.StrokeGetSample2CoagulReportTime()
      this.StrokeGetD2CTReportTime()
      this.StrokeGetThromTalk2SignTime()
      this.StrokeGetCTReport2ThromTime()
      this.StrokeGetDRT()
      this.StrokeGetSurgeryNum()
      this.StrokeGetCeaCasSurgeryModeNum()
      this.StrokeGetNoThromReasonNum()
      this.StrokeGetNoIntervReasonNum()
      this.strokeGetDiagNum()
      this.strokeGetUploadNum()
      this.strokeGetDeptFillInNumRanking()
      this.getStatisticQuota()
    },

    StrokeGetODT() {
      getODT({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(Math.abs(el.avgQuotaMinute))
            })

            this.dataAll.fbzyydm.data[0].labels = timeLine
            this.dataAll.fbzyydm.data[0].values = avgQuotaMinute
          }
        }
      })
    },
    StrokeGetD2Adm() {
      getD2Adm({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(Math.abs(el.avgQuotaMinute))
            })
            this.dataAll.ddyydmzjz.data[0].labels = timeLine
            this.dataAll.ddyydmzjz.data[0].values = avgQuotaMinute
          }
        }
      })
    },
    StrokeGetD2FNT() {
      getD2FNT({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.ddyydmzscry.data[0].labels = timeLine
            this.dataAll.ddyydmzscry.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.ddyydmzscry.data[0].labels = []
            this.dataAll.ddyydmzscry.data[0].values = []
          }
        }
      })
    },
    StrokeGetD2SampleTime() {
      getD2SampleTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.ddyydmzcxwc.data[0].labels = timeLine
            this.dataAll.ddyydmzcxwc.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.ddyydmzcxwc.data[0].labels = []
            this.dataAll.ddyydmzcxwc.data[0].values = []
          }
        }
      })
    },
    StrokeGetSample2BloodReportTime() {
      getSample2BloodReportTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.cxwczxcgjg.data[0].labels = timeLine
            this.dataAll.cxwczxcgjg.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.cxwczxcgjg.data[0].labels = []
            this.dataAll.cxwczxcgjg.data[0].values = []
          }
        }
      })
    },
    StrokeGetSample2CoagulReportTime() {
      getSample2CoagulReportTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.cxwczlxgnjg.data[0].labels = timeLine
            this.dataAll.cxwczlxgnjg.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.cxwczlxgnjg.data[0].labels = []
            this.dataAll.cxwczlxgnjg.data[0].values = []
          }
        }
      })
    },
    StrokeGetD2CTReportTime() {
      getD2CTReportTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.ddyydmzctbg.data[0].labels = timeLine
            this.dataAll.ddyydmzctbg.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.ddyydmzctbg.data[0].labels = []
            this.dataAll.ddyydmzctbg.data[0].values = []
          }
        }
      })
    },
    StrokeGetThromTalk2SignTime() {
      getThromTalk2SignTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.rsthzrsqz.data[0].labels = timeLine
            this.dataAll.rsthzrsqz.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.rsthzrsqz.data[0].labels = []
            this.dataAll.rsthzrsqz.data[0].values = []
          }
        }
      })
    },
    StrokeGetCTReport2ThromTime() {
      getCTReport2ThromTime({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.ctbgzksjmrs.data[0].labels = timeLine
            this.dataAll.ctbgzksjmrs.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.ctbgzksjmrs.data[0].labels = []
            this.dataAll.ctbgzksjmrs.data[0].values = []
          }
        }
      })
    },
    StrokeGetDRT() {
      getDRT({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          const timeLine = []
          const avgQuotaMinute = []
          if (res.data.AvgQuotaMinutes && res.data.AvgQuotaMinutes.length !== 0) {
            res.data.AvgQuotaMinutes.forEach(el => {
              timeLine.push(el.year + '-' + el.month)
              avgQuotaMinute.push(el.avgQuotaMinute)
            })
            this.dataAll.dyzscxgztpjsj.data[0].labels = timeLine
            this.dataAll.dyzscxgztpjsj.data[0].values = avgQuotaMinute
          } else {
            this.dataAll.dyzscxgztpjsj.data[0].labels = []
            this.dataAll.dyzscxgztpjsj.data[0].values = []
          }
        }
      })
    },
    StrokeGetSurgeryNum() {
      getSurgeryNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          this.notHaveData(myChart)
          return
        }
        if (res.data) {
          if (!res.data.surgeryNums || res.data.surgeryNums.length === 0) {
            return
          }
          const timeLine = []
          const sum_subtotalSurgeryNum = res.data.total
          const throm = res.data.subtotalSurgeryNum.throm
          const intervention = res.data.subtotalSurgeryNum.intervention
          const hemorrhage = res.data.subtotalSurgeryNum.hemorrhage
          const aneurysm = res.data.subtotalSurgeryNum.aneurysm
          const ceaCas = res.data.subtotalSurgeryNum.ceaCas

          this.dataAll.jskzqkzyzlcz.data1[0].labels = ['AIS静脉溶栓例数' + ':' + throm, '颅内动脉瘤手术例数' + ':' + aneurysm, 'AIS血管内治疗例数' + ':' + intervention, 'CEA/CAS手术例数' + ':' + ceaCas, '脑出血手术例数' + ':' + hemorrhage]
          this.dataAll.jskzqkzyzlcz.data1[0].values = [throm, aneurysm, intervention, ceaCas, hemorrhage]
          this.dataAll.jskzqkzyzlcz.data2[0].values = [sum_subtotalSurgeryNum]
        }
      })
    },
    StrokeGetCeaCasSurgeryModeNum() {
      getCeaCasSurgeryModeNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          return
        }
        if (res.data) {
          if (!res.data.ceaCasModeNums || res.data.ceaCasModeNums.length === 0) {
            return
          }
          const subtotalCeaCasMode = res.data.subtotalCeaCasMode
          const ceaStantard = subtotalCeaCasMode.ceaStantard
          const ceaEversion = subtotalCeaCasMode.ceaEversion
          const cas = subtotalCeaCasMode.cas
          const composite = subtotalCeaCasMode.composite

          this.dataAll.jskzqkcezcas.data1[0].labels = ['标准式CEA例数' + ':' + ceaStantard, '外翻式CEA例数' + ':' + ceaEversion, 'CAS例数' + ':' + cas, '复合手术例数' + ':' + composite]
          this.dataAll.jskzqkcezcas.data1[0].values = [ceaStantard, ceaEversion, cas, composite]
          this.dataAll.jskzqkcezcas.data2[0].values = [ceaStantard + ceaEversion + cas + composite]
        }
      })
    },
    StrokeGetNoThromReasonNum() {
      getNoThromReasonNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          return
        }

        let noThromReason1_value = 0
        let noThromReason2_value = 0
        let noThromReason3_value = 0
        let noThromReason4_value = 0
        let noThromReasonOther_value = 0

        if (res.data) {
          if (!res.data.noThromReasonNum || !res.data.noThromReasonPercentage) {
            return
          }
          const sum_noThromReasonNum = res.data.total
          noThromReason1_value = res.data.noThromReasonNum.noThromReason1 ? res.data.noThromReasonNum.noThromReason1 : 0
          noThromReason2_value = res.data.noThromReasonNum.noThromReason2 ? res.data.noThromReasonNum.noThromReason2 : 0
          noThromReason3_value = res.data.noThromReasonNum.noThromReason3 ? res.data.noThromReasonNum.noThromReason3 : 0
          noThromReason4_value = res.data.noThromReasonNum.noThromReason4 ? res.data.noThromReasonNum.noThromReason4 : 0
          noThromReasonOther_value = res.data.noThromReasonNum.noThromReasonOther ? res.data.noThromReasonNum.noThromReasonOther : 0
          this.dataAll.jskzqkwrsyy.data1[0].labels = ['超时间窗' + ':' + noThromReason1_value, '禁忌症' + ':' + noThromReason2_value, '患者/家属拒绝' + ':' + noThromReason3_value, '外院溶栓' + ':' + noThromReason4_value, '其他' + ':' + noThromReasonOther_value]
          this.dataAll.jskzqkwrsyy.data1[0].values = [noThromReason1_value, noThromReason2_value, noThromReason3_value, noThromReason4_value, noThromReasonOther_value]
          this.dataAll.jskzqkwrsyy.data2[0].values = [sum_noThromReasonNum]
        }
      })
    },
    StrokeGetNoIntervReasonNum() {
      getNoIntervReasonNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code !== 0) {
          return
        }
        let noIntervReason1_value = 0
        let noIntervReason2_value = 0
        let noIntervReason3_value = 0
        let noIntervReason4_value = 0
        let noIntervReasonOther_value = 0
        if (res.data) {
          if (!res.data.noIntervReasonNum || !res.data.noIntervReasonPercentage) {
            return
          }
          const sum_noIntervReasonNum = res.data.total
          noIntervReason1_value = res.data.noIntervReasonNum.noIntervReason1 ? res.data.noIntervReasonNum.noIntervReason1 : 0
          noIntervReason2_value = res.data.noIntervReasonNum.noIntervReason2 ? res.data.noIntervReasonNum.noIntervReason2 : 0
          noIntervReason3_value = res.data.noIntervReasonNum.noIntervReason3 ? res.data.noIntervReasonNum.noIntervReason3 : 0
          noIntervReason4_value = res.data.noIntervReasonNum.noIntervReason4 ? res.data.noIntervReasonNum.noIntervReason4 : 0
          noIntervReasonOther_value = res.data.noIntervReasonNum.noIntervReasonOther ? res.data.noIntervReasonNum.noIntervReasonOther : 0

          this.dataAll.jskzqkwjyxgnzlyy.data1[0].labels = ['超时间窗' + ':' + noIntervReason1_value, '禁忌症' + ':' + noIntervReason2_value, '患者/家属拒绝' + ':' + noIntervReason3_value, '外院溶栓' + ':' + noIntervReason4_value, '其他' + ':' + noIntervReasonOther_value]
          this.dataAll.jskzqkwjyxgnzlyy.data1[0].values = [noIntervReason1_value, noIntervReason2_value, noIntervReason3_value, noIntervReason4_value, noIntervReasonOther_value]
          this.dataAll.jskzqkwjyxgnzlyy.data2[0].values = [sum_noIntervReasonNum]
        }
      })
    },

    strokeGetDiagNum() {
      getDiagNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (!res.data) {
          return
        }
        const sum_getDiagNum = res.data.total
        if (!sum_getDiagNum || sum_getDiagNum === 0) {
          return
        }
        const countDiagNGS = res.data.diagNum.countDiagNGS
        const countDiagNCX = res.data.diagNum.countDiagNCX
        const countDiagDML = res.data.diagNum.countDiagDML
        const countDiagJDMXZ = res.data.diagNum.countDiagJDMXZ
        const countDiagGiveUp = res.data.diagNum.countDiagGiveUp
        const countDiagUnknown = res.data.diagNum.countDiagUnknown

        this.dataAll.zdfbqktj.data1[0].labels = ['脑梗死' + ':' + countDiagNGS, '脑出血' + ':' + countDiagNCX, '颅内动脉瘤' + ':' + countDiagDML, '颈动脉狭窄或闭塞' + ':' + countDiagJDMXZ, '病因未明放弃治疗' + ':' + countDiagGiveUp, '未知' + ':' + countDiagUnknown]
        this.dataAll.zdfbqktj.data1[0].values = [countDiagNGS, countDiagNCX, countDiagDML, countDiagJDMXZ, countDiagGiveUp, countDiagUnknown]
        this.dataAll.zdfbqktj.data2[0].values = [sum_getDiagNum]
      })
    },
    strokeGetUploadNum() {
      getUploadNum({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (!res.data) {
          return
        }
        const timeLine = []
        const numNotUpload = []
        const numUploaded = []
        const numFillIn = []
        res.data.uploadNums.forEach(el => {
          timeLine.push(el.year + '-' + el.month)
          numNotUpload.push(el.numNotUpload)
          numUploaded.push(el.numUploaded)
          numFillIn.push(el.numFillIn)
        })
        this.dataAll.sbslqs.labels = timeLine
        this.dataAll.sbslqs.data1[0].labels = timeLine
        this.dataAll.sbslqs.data1[0].values = numFillIn
        this.dataAll.sbslqs.data2[0].labels = timeLine
        this.dataAll.sbslqs.data2[0].values = numNotUpload
        this.dataAll.sbslqs.data2[1].labels = timeLine
        this.dataAll.sbslqs.data2[1].values = numUploaded
      })
    },
    strokeGetDeptFillInNumRanking() {
      getDeptFillInNumRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (!res.data) {
          return
        }

        if (res.data.deptFillInNums.length === 0) {
          return
        }
        const deptName = []
        const fillInNum = []
        res.data.deptFillInNums.forEach(el => {
          deptName.push(el.deptName)
          fillInNum.push(el.fillInNum)
        })
        this.dataAll.tblpm.data[0].labels = deptName
        this.dataAll.tblpm.data[0].values = fillInNum
      })
    },
    getStatisticQuota() {
      getStatisticQuota({
        hospitalId: this.$store.getters.hospitalId,
        indexes: this.indicators.join(','),
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data && res.data.length > 0) {
            res.data.forEach(el => {
              el.index = el.index - 1
              const targetData = []
              const timeData = []
              if (el.quotaData && el.quotaData.length > 0) {
                el.quotaData.forEach(e => {
                  targetData.push(e.value ? e.value : 0)
                  timeData.push(e.timeName ? e.timeName : '')
                })
              }
              el.optionData = {
                timeData: timeData,
                targetData: targetData,
                unit: el.unit
              }
            })
            this.dataAll.gfzb = res.data
            // console.log(this.dataAll.gfzb, 'this.dataAll.gfzb')
          } else {
            this.dataAll.gfzb = []
          }
          // console.log(this.gfzb)
          // res.data.forEach(el => {
          //   console.log(el)
          //   if (el.name === "动脉瘤介入栓塞术患者住院死亡率") {
          //     el.index = 24
          //   }
          // })
        } else {
          this.dataAll.gfzb = []
        }
      })
    },
    async fetchImage1() {
      const response = await fetch(this.ppt1)
      const blob = await response.blob()
      const reader = new FileReader()
      reader.onloadend = async () => {
        this.ppt1_data = reader.result
      }
      reader.readAsDataURL(blob)
    },
    async fetchImage2() {
      const response = await fetch(this.ppt2)
      const blob = await response.blob()
      const reader = new FileReader()
      reader.onloadend = async () => {
        this.ppt2_data = reader.result
      }
      reader.readAsDataURL(blob)
    },
    async fetchImage3() {
      const response = await fetch(this.ppt3)
      const blob = await response.blob()
      const reader = new FileReader()
      reader.onloadend = async () => {
        this.ppt3_data = reader.result
      }
      reader.readAsDataURL(blob)
    }
  }

}
</script>
